home *** CD-ROM | disk | FTP | other *** search
/ MacTech 1 to 12 / MacTech-vol-1-12.toast / Source / MacTech® Magazine / Volume 04 - 1988 / 04.01 Jan 88 / Downloader Source / Quickdraw.h < prev    next >
Encoding:
C/C++ Source or Header  |  1986-09-13  |  3.2 KB  |  207 lines  |  [TEXT/KAHL]

  1.  
  2. /*
  3.  *  Quickdraw.h
  4.  *
  5.  *  Copyright (c) 1986 THINK Technologies, Inc.
  6.  *  These interfaces are based on information published in
  7.  *  "Inside Macintosh" by Apple Computer, Addison-Wesley,
  8.  *  Reading (Mass.), 1985.
  9.  *
  10.  */
  11.  
  12. #ifndef    _Quickdraw_
  13. #define _Quickdraw_
  14.     
  15. #ifndef    _MacTypes_
  16. #include "MacTypes.h"
  17. #endif
  18.  
  19.  
  20. /*  transfer modes */
  21. enum {
  22.     srcCopy,
  23.     srcOr,
  24.     srcXor,
  25.     srcBic,
  26.     notSrcCopy,
  27.     notSrcOr,
  28.     notSrcXor,
  29.     notSrcBic,
  30.     patCopy,
  31.     patOr,
  32.     patXor,
  33.     patBic,
  34.     notPatCopy,
  35.     notPatOr,
  36.     notPatXor,
  37.     notPatBic
  38. };
  39.  
  40. /* colors */
  41. #define    blackColor        33
  42. #define    whiteColor        30
  43. #define    redColor        205
  44. #define    greenColor        341
  45. #define    blueColor        409
  46. #define    cyanColor        273
  47. #define    magentaColor    137
  48. #define    yellowColor        69
  49.  
  50. /* standard picture comments */
  51. enum { picLParen, picRParen };
  52.  
  53. /* color mapping */
  54. enum {
  55.     normalBit,
  56.     inverseBit,
  57.     blueBit,
  58.     greenBit,
  59.     redBit,
  60.     blackBit,
  61.     yellowBit,
  62.     magentaBit,
  63.     cyanBit
  64. };
  65.  
  66. typedef    char QDByte, *QDPtr, **QDHandle;
  67.  
  68. typedef enum {
  69.     bold = 1,
  70.     italic = 2,
  71.     underline = 4,
  72.     outline = 8,
  73.     shadow = 16,
  74.     condense = 32,
  75.     extend = 64
  76. } Style;
  77.  
  78. typedef    enum { frame, paint, erase, invert, fill } GrafVerb;
  79.  
  80. typedef unsigned char Pattern[8];
  81. typedef Pattern *PatPtr, **PatHandle;
  82.  
  83. typedef int    Bits16[16];
  84.  
  85. typedef    struct    
  86.     {
  87.     int        ascent;
  88.     int        descent;
  89.     int        widMax;
  90.     int        leading;
  91.     } FontInfo;
  92.     
  93. typedef    struct    
  94.     {
  95.     QDPtr    baseAddr;
  96.     int        rowBytes;
  97.     Rect    bounds;
  98.     } BitMap;
  99.     
  100. typedef    struct
  101.     {
  102.     Bits16    data;
  103.     Bits16    mask;
  104.     Point    hotSpot;
  105.     } Cursor, *CursPtr, **CursHandle;
  106.     
  107. typedef    struct    
  108.     {
  109.     Point    pnLoc;
  110.     Point    pnSize;
  111.     int        pnMode;
  112.     Pattern    pnPat;
  113.     } PenState;
  114.  
  115. typedef    struct
  116.     {
  117.     int        polySize;
  118.     Rect    polyBBox;
  119.     Point    polyPoints[];
  120.     } Polygon, *PolyPtr, **PolyHandle;
  121.  
  122. typedef    struct    
  123.     {
  124.     int        rgnSize;
  125.     Rect    rgnBBox;
  126.     } Region,* RgnPtr,** RgnHandle;
  127.  
  128.  
  129. typedef    struct    
  130.     {
  131.     int        picSize;
  132.     Rect    picFrame;
  133.     } Picture, *PicPtr, **PicHandle;
  134.  
  135. typedef    struct    
  136.     {
  137.     QDPtr    textProc;
  138.     QDPtr    lineProc;
  139.     QDPtr    rectProc;
  140.     QDPtr    rRectProc;
  141.     QDPtr    ovalProc;
  142.     QDPtr    arcProc;
  143.     QDPtr    polyProc;
  144.     QDPtr    rgnProc;
  145.     QDPtr    bitsProc;
  146.     QDPtr    commentProc;
  147.     QDPtr    txMeasProc;
  148.     QDPtr    getPicProc;
  149.     QDPtr    putPicProc;
  150.     } QDProcs,* QDProcsPtr;
  151.  
  152. typedef    struct    GrafPort
  153.     {
  154.     int            device;
  155.     BitMap        portBits;
  156.     Rect        portRect;
  157.     RgnHandle    visRgn;
  158.     RgnHandle    clipRgn;
  159.     Pattern        bkPat;
  160.     Pattern        fillPat;
  161.     Point        pnLoc;
  162.     Point        pnSize;
  163.     int            pnMode;
  164.     Pattern        pnPat;
  165.     int            pnVis;
  166.     int            txFont;
  167.     Style        txFace;
  168.     int            txMode;
  169.     int            txSize;
  170.     long        spExtra;
  171.     long        fgColor;
  172.     long        bkColor;
  173.     int            colrBit;
  174.     int            patStretch;
  175.     QDHandle     picSave;
  176.     QDHandle     rgnSave;
  177.     QDHandle     polySave;
  178.     QDProcsPtr     grafProcs;
  179.     } GrafPort, * GrafPtr;
  180.  
  181. /*  Quickdraw global variables - defined in the MacTraps library  */
  182. extern GrafPtr    thePort;
  183. extern Pattern    white;
  184. extern Pattern    black;
  185. extern Pattern    gray;
  186. extern Pattern    ltGray;
  187. extern Pattern    dkGray;
  188. extern Cursor    arrow;
  189. extern BitMap    screenBits;
  190. extern long        randSeed;
  191.  
  192. /*  functions returning non-integral values  */
  193. pascal RgnHandle NewRgn();
  194. pascal PicHandle OpenPicture();
  195. pascal PolyHandle OpenPoly();
  196.  
  197. /*  low-memory globals  */
  198. extern int ScrVRes : 0x102;
  199. extern int ScrHRes : 0x104;
  200. extern int ScreenRow : 0x106;
  201. extern long RndSeed : 0x156;
  202. extern Ptr ScrnBase : 0x824;
  203. extern Rect CrsrPin : 0x834;
  204.  
  205.  
  206. #endif
  207.